//
//  ST_QuickMessageModel.swift
//  btvideo
//
//  Created by mac on 2021/9/7.
//  Copyright © 2021 JarvanZhang. All rights reserved.
//

import Foundation
import HandyJSON

enum QuickMessageCategory: Int, Equatable {
    case unknow = 0
    /// 文字
    case text = 1
    /// 语音
    case voice = 2
    
    /// 标题
    var title: String {
        switch self {
        case .unknow: return ""
        case .text: return "文字"
        case .voice: return "语音"
        }
    }
}

enum QuickMessageReviewState: Int {
    case unknow = 0
    /// 待审核
    case waitingForReview = 1
    /// 通过
    case accept = 2
    /// 拒绝
    case reject = 3
}

class ST_QuickMessageModel: HandyJSON {
    
    /// 数据ID
    var id: Int = 0
    
    /// 用户ID
    var memberID: Int = 0
    
    /// 语音时长
    var duration: TimeInterval = 0
    
    /// 内容
    var content: String = ""
    
    /// 类型
    var type: QuickMessageCategory = .unknow
    
    /// 审核状态
    var status: QuickMessageReviewState = .unknow
    
    /// 创建时间
    var createTime: Date? = nil
    
    required init() {}
    
    func mapping(mapper: HelpingMapper) {
        mapper <<<
            memberID <-- "member_id"
        mapper <<<
            type <-- EnumTransform()
        mapper <<<
            status <-- EnumTransform()
        mapper <<<
            createTime <-- "create_time"
        mapper <<<
            createTime <-- CustomDateFormatTransform(formatString: "yyyy-MM-dd HH:mm:ss")
    }
}
